<?php
/**
 * DepartmentRepo.php
 *
 * @copyright   2023 thingsworld.com.cn - All Rights Reserved
 * @link        http://thingsworld.com.cn/
 * @author      stiffer.chen <chenl@thingsworld.com.cn>
 * @created     2023-08-26 16:59:14
 * @modified    2023-08-26 16:59:14
 *
 */

namespace App\Repositories;

use App\Models\DeptModel;
use App\Services\DeptService;

class DepartmentRepo
{
    public static function getAllChild($id)
    {
        $service = new DeptService();
        $childIds = $service->getAllChildIds($id);
        return DeptModel::query()
            ->whereIn('id', $childIds)
            ->select(['name', 'id'])
            ->get()
            ->toArray();
    }
}